package zuoye05;

import java.util.ArrayList;
import java.util.Collections;

public class zuoye02 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<String>();
        Collections.addAll(list, "张无忌-男-15", "周芷若-女-14", "赵敏-女-13", "张强-男-20", "张三丰-男-100", "张翠山-男-40","张良-男-35","王二麻子-男-35","谢广坤-女-41","林婷-女-22","林立-女-23");
       int count=0;
       int count2=0;
       String s="";
        for (String str : list) {
           if(str.contains("男"))
           {

               if(str.charAt(2)!='-')
                   { s+=str.substring(0,3);
                       count++;
                   }
           }
           if (count==3)
           {
               break;
           }
       }
        for(String str : list){
           String[] S= str.split("-");
                if(str.contains("女"))
            {
                if(str.contains("林")) {
                    count2++;

                    if (count2 != 1) {
                        s += S[0];

                    }
                } }
        }
        System.out.println(s);
    }
}
